<?php /*a:1:{s:60:"D:\phpstudy_pro\WWW\oldi-erp\app\index\view\login\index.html";i:1748225004;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">   
    <title>后台管理系统</title>
    <link href="/static/login/login.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="/static/css/element-ui@2.15.14.css">
    <script src="/static/js/vue.js"></script>
    <script src="/static/js/element-ui@2.15.14.js"></script>
    <script src="/static/js/axios.js"></script>
    <script src="/static/js/qs.js"></script>
    <script src="/static/js/config.js"></script>
    <script src="/static/js/echart.js"></script>
</head>

<body>
    <div id="app">
        <div class="login_box">
            <div class="login_l_img"><img src="/static/login/images/login-img.png" /></div>
            <div class="login">
                <div class="login_logo"><a href="#"><img src="/static/login/images/login_logo.png" /></a></div>
                <div class="login_name">
                    <p>后台管理系统</p>
                </div>

                <div style="margin-left: -51px">
                    <el-row class="row-bg">
                        <el-col :span="24">
                            <div class="grid-content bg-purple-light">
                                <!-- rules传入约定验证规则 -->
                                <!-- prop绑定要验证的字段名 -->
                                <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px"
                                    class="demo-ruleForm">
                                    <el-form-item label="账号" prop="username">
                                        <el-input v-model="ruleForm.username" clearable></el-input>
                                    </el-form-item>
                                    <el-form-item label="密码" prop="password">
                                        <!-- show-password密码框的小眼睛 -->
                                        <!-- clearable清空选择器,适用于单选框 -->
                                        <el-input v-model="ruleForm.password" show-password clearable></el-input>
                                    </el-form-item>

                                    <el-form-item>
                                        <el-button type="primary" @click="submitForm('ruleForm')">登录</el-button>
                                        <el-button @click="resetForm('ruleForm')">重置</el-button>
                                    </el-form-item>
                                </el-form>
                            </div>
                        </el-col>
                    </el-row>
                </div>
            </div>
            <div class="copyright">福建闽西网络科技有限公司 版权所有©2016-2018 技术支持电话：000-00000000</div>
        </div>
    </div>

    <script>
        let vm = new Vue({
            el: "#app",
            data() {
                return {
                    ruleForm: {
                        username: '',
                        password: '',
                    },
                    rules: {
                        username: [
                            { required: true, message: '请输入账号', trigger: 'blur' },
                           
                        ],
                        password: [
                            { required: true, message: '请输入密码', trigger: 'blur' },
                            // { min: 2, max: 25, message: '长度在  到 25 个字符', trigger: 'blur' }
                        ]
                    },
                    loading: true
                };
            },
            methods: {
                async submitForm() {
                    if(this.ruleForm.username === '' || this.ruleForm.password === ''){
                        this.$message.error('账号或密码不能为空');return
                    }
                    const res = await axios.post('/index/login/login', {params: this.ruleForm})
                    if (res.status !==1) {
						 this.$message.error( res.info);
					}else{
                        this.$message.success(res.info);                      
                        var url = '/admin';
                        location.href = url;
					}
                },
                resetForm(formName) {
                    this.$refs[formName].resetFields();
                }
            }
        });
    </script>
</body>

</html>